package com.salesys.gr.util;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class FrmHelper {
	/**
	 * 使窗口居中显示
	 * 
	 * @param shell
	 * @return
	 */
	public Point setLocationCenter(Shell shell) {
		Rectangle area = Display.getDefault().getClientArea();
		int screenWidth = area.width;
		int screenHeight = area.height;
		int width = shell.getBounds().width;
		int height = shell.getBounds().height;
		int x = (screenWidth - width) / 2;
		int y = (screenHeight - height) / 2;
		Point frmLocation = new Point(x, y);
		return frmLocation;
	}
}
